package com.example.interesting.idempotent.realize.aop;

import com.example.interesting.idempotent.realize.annotation.Idempotent;
import org.aopalliance.aop.Advice;
import org.springframework.aop.Pointcut;
import org.springframework.aop.support.AbstractPointcutAdvisor;

/**
 * @Description: 幂等性切面实现类
 * @Author: fyw
 * @History
 */
public class IdempotentAop extends AbstractPointcutAdvisor {

    private final Pointcut pointcut = new IdempotentPointcut(Idempotent.class);

    private final Advice advice;

    public IdempotentAop(final IdempotentMethodInterceptor idempotentMethodInterceptor, int order) {
        this.advice = idempotentMethodInterceptor;
        super.setOrder(order);
    }

    @Override
    public Pointcut getPointcut() {
        return this.pointcut;
    }

    @Override
    public Advice getAdvice() {
        return this.advice;
    }
}
